package containerlogistik.implementation;

import containerlogistik.interfaces.UniqueId;
/**
 * @param Implementation von UniqueId
 */
public class UniqueIdImpl implements UniqueId {
    
    long id;

    private UniqueIdImpl(long id) {
        this.id = id;
    }
    
    static UniqueId valueOf(long id) {
        return new UniqueIdImpl(id);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) return true;
        if (!(obj instanceof UniqueId)) return false;
        return this.idNumber() == ((UniqueId)obj).idNumber();
    }
    
    @Override
    public long idNumber() {
        return this.id;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 17 * hash + (int) (this.id ^ (this.id >>> 32));
        return hash;
    }

    @Override
    public String toString() {
        return "UniqueId{" + "id=" + this.idNumber() + '}';
    }
    
}
